<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib uri="/WEB-INF/tlds/att.tld" prefix="att"%>
<html>
<head>
	<meta name="decorator" content="moduleEdit" />
	<script type="text/javascript">
		//表单提交
		function formSubmit()
		{
			var path = $('#excelFile').val();
			var point_index=path.lastIndexOf(".");
			var extName = path.substring(point_index+1, path.length);
			if(extName!='xls'){
				top.$.jBox.tip('请选择 格式为*.xls文件进行导入!','warning');
			}else{
				if(confirm("是否已检查所选文件数据正确性！"))
				{
					$("#save").attr("disabled","disabled");
					Oosp_Loading('正在导入，请稍等...');
					document.importForm.submit();
				}
			}
		}
		function openUser(url){
			if(confirm("您确认要给所有供应商开通账号？"))
			{
				$.ajax({
					   type: "POST",
					   url: url,
					   data: null,
					   success: function(textv){
						   var jsonObj = eval('(' + textv + ')');
						   if("S"==jsonObj.returnVal)
						   {
							   top.$.jBox.tip(jsonObj.msg,'success');
						   }else
							{
							   top.$.jBox.tip(jsonObj.msg,'warning');
							}
					   }
				});
			}
		}
		$(function() {
			$("#save").removeAttr("disabled");
		});
	</script>
<style type="text/css">
h4{ border-bottom:1px dotted #ccc; padding-bottom:10px; margin:30px 0 15px; color:#b12028; font-size: 12px;}
</style>
</head>
<body>
<div class="Report_f">
           <div class="Report_f_1">
                <div class="Report_f_title_1">数据初始化</div>
                <ul class="nav nav-tabs Report_f_title_2">
                    <li class="active"><a href="#home" data-toggle="tab">历史数据</a></li>
                    <li><a href="#openuser" data-toggle="tab">初始供应商账号</a></li>
                  </ul>
			<!-- Tab panes -->
			<div class="tab-content Report_f_title_3">
                  <div class="tab-pane active" id="home">
                         <div class="Report_f_title_4">
                         <form id="importForm" name="importForm" method="post"  action="${contextPath}/biz/brand/excel/importExcel"  enctype="multipart/form-data">
						<tags:message content="${message}"/>
						<div class="f_3">
		                      <div class="form-group col-xs-12">
								<label for="dateType" class="col-lb-1 control-label f_10">供应商：</label>
								<div class="col-sm-10 col-lb-2 f_6">
									<input type="radio" id="dateType0" name="dateType" checked="checked" value="0"/>百货供应商
									<input type="radio" id="dateType1" name="dateType" value="1"/>综超供应商
								</div>
							 </div>
						</div>
						<div class="f_3">
		                      <div class="form-group col-xs-12">
								<label for="dateType" class="col-lb-1 control-label f_10">品&nbsp;牌：</label>
								<div class="col-sm-10 col-lb-2 f_6">
									<input type="radio" id="dateType2" name="dateType" value="2"/>百货品牌
									<input type="radio" id="dateType2" name="dateType" value="3"/>综超品牌
								</div>
							 </div>
						</div>
						<div class="f_3">
		                      <div class="form-group col-xs-12">
								<label for="dateType" class="col-lb-1 control-label f_10">品牌责任人：</label>
								<div class="col-sm-10 col-lb-2 f_6">
									<input type="radio" id="dateType2" name="dateType" value="4"/>品牌责任人
								</div>
							 </div>
						</div>
						<div class="f_3">
		                      <div class="form-group col-xs-12">
								<label for="dateType" class="col-lb-1 control-label f_10">评审记录：</label>
								<div class="col-sm-10 col-lb-2 f_6">
									<input type="radio" id="dateType2" name="dateType" value="5"/>品牌
									<input type="radio" id="dateType2" name="dateType" value="6"/>供应商
								</div>
							 </div>
						</div>
						<div class="f_3">
		                      <div class="form-group col-xs-12">
								<label for="file" class="col-lb-1 control-label f_10">导入文件(*.xls):</label>
								<div class="col-sm-10 col-lb-2 f_6">
									<input type="file" size="40" name="excelFile" id="excelFile"/>
								</div>
							 </div>
						</div>
				   <div class="f_12">
				     <button type="button" class="btn btn-danger btn_5 btn_right" onclick="history.go(-1)">返&nbsp;回</button>
				     <button type="button" id="save" class="btn btn-success btn_5 btn_right" onclick="formSubmit();">导&nbsp;入</button>
				   </div>
			   </form>
			   		<h4>异常记录（文件名：${fileName}）：</h4>
					<table class="table table-striped table-hover o-l-table table-bordered" id="table1">
						<tbody>
							<c:forEach items="${msgList}" var="item" varStatus="var">
								<tr>
									<td>${item}</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
                   </div>
              </div>
              <div class="tab-pane" id="openuser">
			  	<div class="Report_f_title_4">
				  	<h4>开通供应商账号</h4>
					<div class="f_2">	
						<div class="form-group col-sm-6">
							<label for="brand.brandCname" class="col-sm-9 control-label f_4">开通所有供应商(给供应商开通一个账号，默认设置供应商编码为账号名称，密码1~8数字):</label>
							<div class="col-sm-4 f_6">
								<button type="button" id="openSupplierUser" class="btn btn-success btn_5" onclick="openUser('${contextPath}/biz/brand/supplierUser/batchOpenUser')">开通所有</button>
							</div>
						</div>
					</div>
				</div>
			  </div>
		  </div>
	</div>	
</div>
</body>
</html>